package org.jeecg.modules.shiro;

import lombok.Data;
import org.apache.shiro.authc.AuthenticationToken;
import org.jeecg.modules.wechat.entity.WxUser;

/**
 * TODO: 微信小程序授权登录凭证
 *
 * @author Zhang Hao yu
 * @date 2020/11/12 21:12
 */
@Data
public class WxUserToken implements AuthenticationToken {
    /**不隐密信息*/
    private String rawData;
    /**登录后获取到的用户信息*/
    private WxUser user;
    public WxUserToken(WxUser user) {
        this.user = user;
    }

    @Override
    public Object getPrincipal() {
        return this.getUser();
    }

    @Override
    public Object getCredentials() {
        return this.getUser().getOpenId();
    }

}